package com.tan.po;

import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Repository
@Scope("singleton")//配置作用域singleton 单实例 prototype 多实例
@ImportResource({"classpath:bean2.xml"})
public class User {
    public User(){
        System.out.println("构造方法");
    }
    @PostConstruct
    public void init(){
        System.out.println("初始化方法");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("销毁方法");
    }
}
